package com.innovamed.websocket.model;

import java.util.Date;

import com.google.gson.Gson;

import com.innovamed.websocket.utils.time.DateUtils;

/**
 * @author: chenwei
 * @date: 2019-07-01 14:42
 * @description: TODO
 * @class:WebContent
 */
public class WebContent {
    /**
     * 流水线ID
     */
    String pipelineId;
    /**
     * 阶段ID
     */
    String stageId;
    /**
     * 任务ID
     */
    String taskId;
    /**
     * 操作时间
     */
    final String operDateTime= DateUtils.getDateTime(new Date());
    /**
     * 任务执行状态
     */
    String state;
    /**
     * 完成速率
     */
    String rate;


    public WebContent(String pipelineId, String stageId, String taskId, String rate,String state) {
        this.pipelineId = pipelineId;
        this.stageId = stageId;
        this.taskId = taskId;
        this.rate = rate;
        this.state = state;
    }

    public WebContent() {
    }

    public String getPipelineId() {
        return pipelineId;
    }

    public void setPipelineId(String pipelineId) {
        this.pipelineId = pipelineId;
    }

    public String getStageId() {
        return stageId;
    }

    public void setStageId(String stageId) {
        this.stageId = stageId;
    }

    public String getTaskId() {
        return taskId;
    }

    public void setTaskId(String taskId) {
        this.taskId = taskId;
    }

    public String getOperDateTime() {
        return operDateTime;
    }

    public String getRate() {
        return rate;
    }

    public void setRate(String rate) {
        this.rate = rate;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    /**
     * 获取WebSocket消息实例的全部Json信息;
     * @return
     */
    public String getFullMsgJson() {
        Gson gson = new Gson();
        return gson.toJson(this);
    }
}
